# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=creddump
pkgver=3.ed95e1a
pkgrel=3
groups=('blackarch' 'blackarch-cracker' 'blackarch-windows')
pkgdesc='A python tool to extract various credentials and secrets from Windows registry hives.'
url='https://github.com/moyix/creddump'
arch=('any')
license=('GPL2')
depends=('python2' 'python2-pycryptodome')
makedepends=('git')
source=("$pkgname::git+https://github.com/moyix/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}


prepare() {
  cd "$pkgname"

  sed -i 's/env python/env python2/' *.py
}

package() {
  cd "$pkgname"

  install -dm 755 "$pkgdir/usr/share/windows/$pkgname/"
  install -dm 755 "$pkgdir/usr/bin/"

  cp -R --no-preserve=ownership framework "$pkgdir/usr/share/windows/$pkgname/"
  install -Dm 755 -t "$pkgdir/usr/share/windows/$pkgname" cachedump.py \
    lsadump.py pwdump.py
  install -Dm 644 README "$pkgdir/usr/share/doc/$pkgname/README"

  ln -sf "/usr/share/windows/$pkgname/cachedump.py" "$pkgdir/usr/bin/cachedump"
  ln -sf "/usr/share/windows/$pkgname/lsadump.py" "$pkgdir/usr/bin/lsadump"
  ln -sf "/usr/share/windows/$pkgname/pwdump.py" "$pkgdir/usr/bin/pwdump"
}

